struct Solution {}

fn main() {}

impl Solution {
    pub fn remove_element(nums: &mut Vec<i32>, val: i32) -> i32 {
        let mut idx_check = 0;
        let mut idx_place = 0;
        while idx_check != nums.len() {
            if nums[idx_check] != val {
                nums[idx_place] = nums[idx_check];
                idx_check += 1;
                idx_place += 1;
            } else {
                idx_check += 1;
            }
        }
        return idx_place as i32;
    }
}